package xupt.se.ttms.service;

import java.sql.ResultSet;
import java.util.List;

import xupt.se.ttms.idao.DAOFactory;
import xupt.se.ttms.idao.iOrderDAO;
import xupt.se.ttms.model.Order;

public class OrderSrv {
	private iOrderDAO orderDAO=DAOFactory.creatOrderDAO();
	public boolean add(Order order) throws Exception{
		
		return orderDAO.execInsert(order);
	}
	
	public boolean modify(Order order) throws Exception{
		return orderDAO.execUpdate(order); 		
	}
	
	public boolean delete(int ID) throws Exception{
		return orderDAO.execDelete(ID);		
	}
	
	public List<Order> Fetch(Integer order_id) throws Exception{
		ResultSet resultSet=orderDAO.execQuery(order_id);	
		return orderDAO.HandleOrderResultSet(resultSet);	
	}
	
	public List<Order> FetchAll() throws Exception{
		ResultSet resultSet=orderDAO.exexQueryAll();
		return orderDAO.HandleOrderResultSet(resultSet);		
	}
}
